<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/10/24 0024
  Time: 11:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fnt" uri="http://java.sun.com/jsp/jstl/functions" %>
<link rel="stylesheet" type="text/css" href="/manage/css/static/question-type/mymian.css"/>
<span class="r">共有数据：<strong>${examinationCount}</strong> 条</span>
<table class="table table-border table-bordered table-hover table-bg table-sort">
    <thead>
    <tr class="text-c">
        <th>考试ID</th>
        <th>考试标题</th>
        <th>考试开始时间</th>
        <th>考试截止时间</th>
        <th>考试发布者</th>
        <th>发布者权限</th>
        <th>考题设置</th>
        <th>参考人员</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${pageInfo.list}" var="examination" varStatus="stat">
        <tr class="text-c">
            <td id="examination-id">${examination.id}</td>
            <td>${examination.examinationTitle}</td>
            <td>
                <f:formatDate value="${examination.examinationStartTime}" pattern="yyyy-MM-dd"></f:formatDate>
            </td>
            <td>
                <f:formatDate value="${examination.examinationEndTime}" pattern="yyyy-MM-dd"></f:formatDate>
            </td>
            <td>${examination.admin.adminAccount}</td>
            <td>
                <c:if test="${examination.admin.superAdmin}" var="isCur">
                    超级管理员
                </c:if>
                <c:if test="${not isCur}">
                    普通管理员
                </c:if>
            </td>
            <td>
                <a href="javascript:;" onclick="test_paper_structure('考题结构','/manage/examination/test-paper-structure-list?examinationId=${examination.id}','800','500')" class="btn btn-primary radius">
                    <i class="Hui-iconfont">&#xe600;</i> 考题结构</a>

            </td>
            <td>
                <a href="javascript:;" onclick="test_user('参考人员','/manage/examination/examination-participants-list?examinationId=${examination.id}','800','500')" class="btn btn-primary radius">
                    <i class="Hui-iconfont">&#xe600;</i> 参考人员</a>
            </td>
            <td class="td-manage">
                <a title="删除" href="javascript:;" onclick="member_del(${examination.id})" class="ml-5" style="text-decoration:none">
                    <i class="Hui-iconfont">&#xe6e2;</i>
                </a>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>
<div class="list-page">
    <a href="/manage/examination/examination-manage-list-hh?pageNum=${pageInfo.prePage}" data="${pageInfo.prePage}">上一页</a>
    <c:forEach items="${pageInfo.navigatepageNums}" var="i">
        <c:if test="${pageInfo.pageNum eq i}" var="isCur">
            <span class="current">${i}</span>
        </c:if>
        <c:if test="${not isCur}">
            <a href="#" data="${i}">${i}</a>
        </c:if>
    </c:forEach>
    <a href="/manage/examination/examination-manage-list-hh?pageNum=${pageInfo.nextPage}" data="${pageInfo.nextPage}">下一页</a>
</div>
<script src="/manage/js/lib/question-type/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="/manage/js/lib/layer/2.4/layer.js"></script>
<script>
    $(function(){
        $('.table-sort').dataTable({
            "aaSorting": [[ 1, "desc" ]],//默认第几个排序
            "bStateSave": true,//状态保存
            "aoColumnDefs": [
                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                {"orderable":false,"aTargets":[0,8,9]}// 制定列不参与排序
            ]
        });

    });
    function test_paper_structure(title,url,w,h){
        layer_show(title,url,w,h);
    }
    function test_user(title,url,w,h){
        layer_show(title,url,w,h);
    }

    //删除考试记录信息
    function member_del(id){
        layer.confirm('确定要删除吗?',function (index) {
            var data={id:id};
            $.ajax({
                url:"/manage/examination/updateExaminationById",
                type:'post',
                data:data,
                success:function (data) {
                    $(".ml-5").parent().parent().remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                },
                error:function (data) {
                    console.log(data.msg);
                }
            });
        });
    }
</script>